
include ./Makefile.inc

CONF = dir_input=/usr/local/include/FL dir_inc=FL fixing=fixing.txt

CC = g++
CXX = g++

FLTK = DaoFLTK.so

CFLAG = -c -O2 -I. -I/usr/local/dao
LFLAG =
LIB = -L/usr/local/lib -lpng -lz -lfltk -lfltk_forms -lfltk_gl -lfltk_images -lfltk_jpeg

UNAME = $(shell uname)

ifeq ($(UNAME), Linux)
  CFLAG += -fPIC
  LFLAG += -shared -Wl,-soname,libdaofltk13.so
endif

ifeq ($(UNAME), Darwin)
  FLTK = DaoFLTK.dylib
  CFLAG += -fPIC
  LFLAG += -dynamiclib -install_name libdaofltk13.dylib
  LFLAG += -framework OpenGL -lpthread  -framework Carbon -framework Cocoa -framework ApplicationServices -framework AudioToolbox -framework AGL -framework GLUT
endif

all: $(FLTK)

dao_FLTK.o: dao_FLTK.h dao_FLTK.cpp
	$(CXX) $(CFLAG) dao_FLTK.cpp -o dao_FLTK.o

dao_FLTK2.o: dao_FLTK.h dao_FLTK2.cpp
	$(CXX) $(CFLAG) dao_FLTK2.cpp -o dao_FLTK2.o

dao_FLTK3.o: dao_FLTK.h dao_FLTK3.cpp
	$(CXX) $(CFLAG) dao_FLTK3.cpp -o dao_FLTK3.o

$(FLTK): dao_FLTK.o dao_FLTK2.o dao_FLTK3.o
	$(CXX) dao_FLTK.o dao_FLTK2.o dao_FLTK3.o $(LFLAG) -o $(FLTK) $(LIB)


bind:
	autobind.dao $(FLTK_INC) lang=cpp wrap_name=FLTK $(CONF) del_tests="Fl_Widget@self->Fl_Widget::parent()==NULL;"

bind-valgrind:
	valgrind --tool=memcheck --leak-check=full --dsymutil=yes ../../../dao ../../../tools/autobind.dao $(FLTK_INC) lang=cpp wrap_name=FLTK $(CONF)

bind2:
